import React from 'react';
import { connect } from 'react-redux';
import 'css/components/invite.less';
import { accectOrder,yueOrder } from 'action/service'



class MyInviteList extends React.Component{
    constructor(props){
        super(props); 
        this.state = {
            status:1,
        }
    }
    // clickTips(id){
    //     if(this.state.type == 0){
    //        this.setState(Object.assign({},this.state,{
    //            type:'1',
    //            zanImg: "/image/has-zan.png"
    //        })) 
    //    }else{
    //         this.setState(Object.assign({},this.state,{
    //             type:'0',
    //             zanImg: "/image/zan.png"
    //         })) 
    //    }
    //     this.props.clickTips(id)
    // }
    accept(id){
        this.props.accept(id);
    }
    reject(id){
        this.props.reject(id);
    }
    hasMoreList(){
        this.props.getMoreList();
    }
    render(){
        let self = this;
        return(
            <div className="invites-list">
                {
                    this.props.getMyInviteList.list ? this.props.getMyInviteList.list.map(function(invite){
                        return(
                            <div className="invite-list" key={invite.orderId} >
                                <div className="invite-mess">
                                    <div className="header-img">
                                        <img src='/image/header.jpg' alt="用户头像" />
                                    </div>
                                    <p className="mess-detail">
                                        <span className="user-cla mess-text">{invite.course}</span>
                                        <span className="user-name mess-text">{invite.name}</span>
                                    </p>
                                    <div className="y-opration">
                                        <div className="opration-detail accect-opration" onClick={() => {self.accept(invite.orderId)}}> 接受</div>
                                        <div className="opration-detail" onClick={() => {self.reject(invite.orderId)}}> 拒绝</div>
                                    </div>
                                    
                                    <p className="mess-remark">
                                        {invite.content}
                                    </p>
                                    <p className="mess-price-time">
                                        <span className="mess-price">{invite.price/100}元/小时</span>
                                        <span className="mess-time">有效期至：{invite.dtime}</span>
                                    </p>
                                </div> 
                            </div>
                        );
                    }): <div className="list-mess">暂时无数据</div>
                }
                {
                    ((this.props.getMyInviteList.total/10).toFixed(0)>this.props.getMyInviteList.pageNo && this.props.getMyInviteList.total!=0)?
                    <div className="hasMore" onClick={()=>this.hasMoreList()}>加载更多</div>:''
                }
            </div>
        );
    }
}

export default MyInviteList;